<?php 
@header("Content-Type:text/html;charset=utf-8");
@include_once("conn.php");
@include_once("common.php");

if(!(isset($_GET["key"]))){
    paramsErr();
}

$key=$_GET["key"];
$sql="select * from `goodslist` where goodsName like '%$key%'";
$result=mysqli_query($conn,$sql);
$obj=array();
if($result){
    $list=array();
    while($item=mysqli_fetch_assoc($result)){
    array_push($list,$item);
    }
    if($list){
        $obj["status"] = true;
        $obj["msg"] = "success";
        // $listLimit["limit"]=array_splice($list,0,7);
        $obj["list"]=array_splice($list,0,7);
    }else{
        $obj["status"] = false;
    }
}else{
    $obj["status"] = false;
    $obj["msg"] = "sql语句有误";
    $obj["sql"] = $sql;
}

echo json_encode($obj);
?>